package com.org.Bibliotech;

/**
 * Created by Joshua on 6/7/2014.
 */

import java.util.ArrayList;


public class Library {
    private ArrayList<Book> availableBooks;
    private ArrayList<Book> checkedOutBooks;

    public Library(ArrayList<Book> availableBooks){
        this.availableBooks = availableBooks;
        this.checkedOutBooks = new ArrayList<Book>();
    }


    public ArrayList<Book> getAvailableBooks(){
        return availableBooks;
    }

    public int getNumberOfBooks(){
        return availableBooks.size();
    }

    public ArrayList<Book> getCheckedOutBooks(){
        return checkedOutBooks;
    }



    public  boolean checkoutBook(Book book){

        if(!availableBooks.contains(book))
            return false;

        availableBooks.remove(book);
        checkedOutBooks.add(book);

        return true;

    }

    public boolean returnBook(Book book){

        if(!checkedOutBooks.contains(book))
            return false;


        checkedOutBooks.remove(book);
        availableBooks.add(book);


        return true;
    }







}
